package com.hss.rxjava.bean;


import com.hss.rxjava.CheckInterface;
import com.hss.rxjava.StringUtils;

import java.util.LinkedList;

public class CartItem implements CheckInterface {
	public int cartId;//购物车ID  非必需
	public String productIcon;//商品列表中图片
	public String title;//商品名称，标题
	public String productCount;//数量
	public String productId;//商品ID
	public String beforePrice;//原价    非必需
	public String currentPrice;//现价
	public String status;//商品状态 0: 正常,1: 失效
	public String postFee;//运费
	public String agencyId;//供应商ID
	public String agencyName;//供应商名称
	public String goodsRemain;//剩余商品数量
	public String goodsCode;//商品编号
	public String agencyCode;//供应商编码 组织代码
	public int goodsSource;//1.医药云的商品   2.我们自己的商品  3.可以保单结算的商品
	public LinkedList<CartItemBenefit> benefit;//[{“type”:”1”, “sum”：79}]//item为1是满额包邮

	public LinkedList<CartItemBenefit> getBenefit() {
		return benefit;
	}

	public void setBenefit(LinkedList<CartItemBenefit> benefit) {
		this.benefit = benefit;
	}

	public String getGoodsCode() {
		return goodsCode;
	}

	public void setGoodsCode(String goodsCode) {
		this.goodsCode = goodsCode;
	}

	public String getAgencyCode() {
		return agencyCode;
	}

	public void setAgencyCode(String agencyCode) {
		this.agencyCode = agencyCode;
	}

	public int getGoodsSource() {
		return goodsSource;
	}

	public void setGoodsSource(int goodsSource) {
		this.goodsSource = goodsSource;
	}

	public boolean checked;//在购物车列表中是否被勾选|非传入值    非必需

	public boolean isChecked() {
		return checked;
	}

	public void setChecked(boolean checked) {
		this.checked = checked;
	}

	public int getCartId() {
		return cartId;
	}
	public void setCartId(int cartId) {
		this.cartId = cartId;
	}
	public String getProductIcon() {
		return productIcon;
	}
	public void setProductIcon(String productIcon) {
		this.productIcon = productIcon;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getProductCount() {
		return productCount;
	}
	public void setProductCount(String productCount) {
		this.productCount = productCount;
	}
	public String getProductId() {
		return productId;
	}
	public void setProductId(String productId) {
		this.productId = productId;
	}
	public String getBeforePrice() {
		return beforePrice;
	}
	public void setBeforePrice(String beforePrice) {
		this.beforePrice = beforePrice;
	}
	public String getCurrentPrice() {
		return currentPrice;
	}
	public void setCurrentPrice(String currentPrice) {
		this.currentPrice = currentPrice;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public String getPostFee() {
		return postFee;
	}
	public void setPostFee(String postFee) {
		this.postFee = postFee;
	}
	public String getAgencyId() {
		return agencyId;
	}
	public void setAgencyId(String agencyId) {
		this.agencyId = agencyId;
	}
	public String getAgencyName() {
		return agencyName;
	}
	public void setAgencyName(String agencyName) {
		this.agencyName = agencyName;
	}
	public String getGoodsRemain() {
		return goodsRemain;
	}
	public void setGoodsRemain(String goodsRemain) {
		this.goodsRemain = goodsRemain;
	}


	@Override
	public boolean check(int index) {
		if(!StringUtils.isNotNull(agencyName,title))return false;
		if(!StringUtils.isValidate(
				agencyId,productCount,productId,currentPrice,goodsRemain,agencyCode
		))return false;
		return true;
	}

	@Override
	public void fix(int index) {
		agencyName = StringUtils.makeStringNotNull(agencyName);
		title = StringUtils.makeStringNotNull(title);
	}
}
